<!--
/**************************************************
* @(#)checkManufacture.jsp
*
* Copyright (c) 2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/08, SimonyiPeng
*  1) first release
/**************************************************
-->

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.hitrust.gs.business.GSManufactureProcessor"%>
<%@ page import="com.hitrust.gs.bean.GSManufactureBean"%>
<%@ include file="../../common.jsp" %>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>


<%

boolean isManufactureExist = false;
GSManufactureBean bean = null;
String rowNum = request.getParameter("rownum");
String concentricityId = request.getParameter("concentricityid");

GSManufactureProcessor processor = new GSManufactureProcessor ();
GSManufactureBean tBean = processor.getManufactureForOrderInput(concentricityId);

String manufactureId = null;
String manufactureName = null;
String quantUnit = null;
String manufactureUnitPrice = null;
String spec = null;
String type = null;
String brand = null;
String quantunit = null;
String period = null;
String mode=null;
String s=null;
boolean bool = false;

if(tBean != null){
	//System.out.println("xxx");

	manufactureId = tBean.getGs_manufacture_id();
	concentricityId = tBean.getGs_concentricity();
	manufactureName = tBean.getGs_manufacture_name();
	quantUnit = tBean.getGs_quant_unit();
	manufactureUnitPrice = StringUtils.formatEDouble(tBean.getGs_manufacture_unitprice(),4);
	spec = StringUtils.escapeXML(tBean.getGs_manufacture_spec());
	type = tBean.getGs_manufacture_type();
	quantunit = tBean.getGs_quant_unit();
	brand = tBean.getGs_manufacture_brand();
	period = tBean.getGs_quality_assure_period();
	mode=tBean.getGs_balance_mode();
	bool = true;
    s=DefineDic.getBalanceMode(mode);
}
%>

<html>
<body onLoad="onsubmit();"></body>
<script language='javascript'>	
	function onsubmit(){

		if(<%=bool%>){
        
			parent.document.getElementById("manufactureid"+<%=rowNum%>).value = '<%=manufactureId%>';
			parent.document.getElementById("concentricityid"+<%=rowNum%>).value = '<%=concentricityId%>';

			if("1501" == parent.document.getElementById("currmenu").value){
				parent.document.getElementById("manufacturename"+<%=rowNum%>).innerHTML="<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A150103.do")%>?concentricityId="+"<%=concentricityId%>"+"' target='_blank'>"+"<%=manufactureName%>"+"</a></div>";
			}else if("1001" == parent.document.getElementById("currmenu").value){
				parent.document.getElementById("manufacturename"+<%=rowNum%>).innerHTML="<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A100104.do")%>?concentricityId="+"<%=concentricityId%>"+"' target='_blank'>"+"<%=manufactureName%>"+"</a></div>";
			}
			
			parent.document.getElementById("manufactureunitprice"+<%=rowNum%>).value = '<%=manufactureUnitPrice%>';

			parent.document.getElementById("spec"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=spec%>'+"</div>";
			parent.document.getElementById("type"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=type%>'+"</div>";
			parent.document.getElementById("brand"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=brand%>'+"</div>";
			parent.document.getElementById("quantunit"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=quantunit%>'+"</div>";
			parent.document.getElementById("referenceprice"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=manufactureUnitPrice%>'+"</div>";
			parent.document.getElementById("period"+<%=rowNum%>).innerHTML = "<div align='center' class='txt_content'>"+'<%=period%>'+"</div>";
            parent.document.getElementById("divmode"+<%=rowNum%>).innerText="<%=s%>";
			//为确认提示预备值
			if(parent.document.getElementById("manufacturename_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturename_"+<%=rowNum%>).value = "<%=manufactureName%>";
			if(parent.document.getElementById("manufacturespec_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturespec_"+<%=rowNum%>).value = "<%=spec%>";
			if(parent.document.getElementById("manufacturetype_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturetype_"+<%=rowNum%>).value = "<%=type%>";
			if(parent.document.getElementById("manufacturebrand_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturebrand_"+<%=rowNum%>).value = "<%=brand%>";
			if(parent.document.getElementById("manufactureunitprice_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufactureunitprice_"+<%=rowNum%>).value = "<%=manufactureUnitPrice%>";
			if(parent.document.getElementById("manufacturequantunit_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturequantunit_"+<%=rowNum%>).value = "<%=quantunit%>";
			if(parent.document.getElementById("period_"+<%=rowNum%>)!=null)
				parent.document.getElementById("period_"+<%=rowNum%>).value = "<%=period%>";
            if(parent.document.getElementById("mode"+<%=rowNum%>)!=null)
                parent.document.getElementById("mode"+<%=rowNum%>).value = "<%=mode%>";

		}
		else{
			parent.document.getElementById("manufactureid"+<%=rowNum%>).value = '';
			parent.document.getElementById("concentricityid"+<%=rowNum%>).value = '';
			parent.document.getElementById("manufacturename"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("manufactureunitprice"+<%=rowNum%>).value = '';

			parent.document.getElementById("spec"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("type"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("brand"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("quantunit"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("referenceprice"+<%=rowNum%>).innerHTML = '';
			parent.document.getElementById("period"+<%=rowNum%>).innerHTML = '';
            parent.document.getElementById("divmode"+<%=rowNum%>).innerText = '';
			//为确认提示清理预备值
			if(parent.document.getElementById("manufacturename_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturename_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("manufacturespec_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturespec_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("manufacturetype_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturetype_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("manufacturebrand_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturebrand_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("manufactureunitprice_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufactureunitprice_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("manufacturequantunit_"+<%=rowNum%>)!=null)
				parent.document.getElementById("manufacturequantunit_"+<%=rowNum%>).value = "";
			if(parent.document.getElementById("period_"+<%=rowNum%>)!=null)
				parent.document.getElementById("period_"+<%=rowNum%>).value = "";
            if(parent.document.getElementById("mode"+<%=rowNum%>)!=null)
                parent.document.getElementById("mode"+<%=rowNum%>).value = "";
						
			alert("集中编码输入不正确，请核实...");
		}

		return  false;
	}
</script>
</html>


